package javagamecontroller.activities.controllers;

/**
 * This class turns an imageview into a button by storing pressed, and not
 * pressed states, and the logic of which state to display
 * 
 * @author Ben Schwab
 * 
 */
public class AndroidButton {

    private boolean myIsButtonPressed;
    private int myDrawState;
    private int myNotPressedState;
    private int myPressedState;

    /**
     * Create a new Android Button
     * 
     * @param notPressed int resource for notPressed state
     * @param pressed int resource for pressed state
     */
    public AndroidButton (int notPressed, int pressed) {
        myDrawState = notPressed;
        myIsButtonPressed = false;
        myNotPressedState = notPressed;
        myPressedState = pressed;
    }
    /**
     * 
     * @param isPressed parameter to change the pressed state of the button
     */
    public void setPressed (boolean isPressed) {
        myIsButtonPressed = isPressed;
    }
    /**
     * 
     * @return the integer of the resource of the current draw state.
     */
    public int getDrawState () {
        if (myIsButtonPressed) {
            myDrawState = myPressedState;
        }
        else {
            myDrawState = myNotPressedState;
        }
        return myDrawState;
    }
    /**
     * 
     * @return true if the button is pressed, false if not pressed
     */
    public boolean getButtonPressed () {
        return myIsButtonPressed;
    }

}
